# 1.
# arr = [1, 2, 3, "str111", "asdasd", "qwdsa3d165", 1, 2, 3, "asdqw", "小天才", "QA"]
# for i in arr[::-1]:
#     if type(i) == str:
#         arr.remove(i)
# print(arr)

# 2.
# for i in arr:
#     if arr.count(i) > 1:
#         arr.remove(i)
# print(arr)

# 3.
# l1 = [1, 2, 3, 4, 5]
# (1)
# l1.insert(3, 300)
# print(l1)
# (2)
# l1.remove(2)
# print(l1)
# (3)
# for i in range(len(l1)):
#     if l1[i] == 5:
#         l1[i] = 500
# print(l1)
# (4)
# l1 = [1, 2, 3, 4, 5]
# print(l1[1:4])

# (5)
# l1 = [1, 2, 3, 4, 5]
# print(l1[-3:-5:-1])

# (6)
# l1 = [1, 2, 3, 4, 5]
# print(l1[-3::-1])

# 2. 通过input引导用户输入一个姓名，判断该姓名是否存在于列表names中 names = ["xi","eric","alvin","george"]
# names = ["xi","eric","alvin","george"]
# name = input('请输入姓名')
# if name in names:
#     print("存在")
# else:
#     print("不纯在")

"""
4、l = [1,2,3,[4,5]]
（1）将4修改为400
（2）在l的[4，5]列表中追加一个6，即使l变为[1,2,3,[4,5,6]]
"""
# (1)
# l = [1, 2, 3, [4, 5]]
# for i in range(len(l)):
#     if type(l[i]) == list:
#         l2 = l[i]
#         for i in range(len(l2)):
#             if l2[i] == 4:
#                 l2[i] = 400
# print(l)
# (2)
# l = [1, 2, 3, [4, 5]]
# for i in range(len(l)):
#     if type(l[i]) == list:
#         l2 = l[i]
#         l2.append(6)
# print(l)

"""
5、小明去超市购买水果，账单如下
苹果  32.8
香蕉  22
葡萄  15.5
请将上面的数据存储到字典里，可以根据水果名称查询购买这个水果的费用
很简单哦，用水果名称做key，金额做value，创建一个字典

"""
# dict1 = dict()
# dict1.update({"苹果": "32.8", "香蕉": "22", "葡萄": "15.5"})
# print(dict1.values())

"""
6、dic = {
    'python': 95,
    'java': 99,
    'c': 100
}
字典的长度是多少
请修改'java' 这个key对应的value值为98
删除 c 这个key
增加一个key-value对，key值为 php, value是90
获取所有的key值，存储在列表里
获取所有的value值，存储在列表里
判断 javascript 是否在字典中
获得字典里所有value 的和
获取字典里最大的value
获取字典里最小的value
字典 dic1 = {'php': 97}， 将dic1的数据更新到dic中
"""
# dic = {
#     'python': 95,
#     'java': 99,
#     'c': 100
# }
# print(len(dic))
# dic['java'] = 98
# # print(dic)
# # dic.pop('c')
# print(dic)
# dic.update({"php": "90"})
# print(dic)

# todo:获取key
# list1 = []
# for i in dic.keys():
#     list1.append(i)
# print(list1)
# todo:获取values
# list2 = []
# for i in dic.values():
#     list2.append(i)
# print(list2)

# todo:判断 javascript 是否在字典中
# print('javascript' in dic.keys())

# todo:获得字典里所有value 的和
# dic['总成绩'] = dic["python"] + dic['java'] + dic['c']
# print(dic['总成绩'])

# todo:获取字典里最大的value
dic = {
    'python': 95,
    'java': 99,
    'c': 100
}
lis = dic.values()
lis1 = list(lis)

for i in range(len(lis1)-1):
    for j in range(len(lis1)-i-1):
        if lis1[j] > lis1[j+1]:
            lis1[j], lis1[j+1] = lis1[j+1], lis1[j]

max_value = lis1[-1]
min_value = lis1[0]
print(max_value,min_value)












"""
list1 = [12,45,78,12,45,78,12,77,99,53,6,93]
7、将重复的列表值加到一个新的字典里，key为数字，value为出现的次数
8、求出列表里最大的数是多少（不允许用sort等其他内置函数去做）,以及这个数所在的索引位置
"""
list1 = [12, 45, 78, 12, 45, 78, 12, 77, 99, 53, 6, 93]
result_dict = {}

for num in list1:
    if list1.count(num) > 1:
        if num in result_dict:
            result_dict[num] += 1
        else:
            result_dict[num] = 1
print(result_dict)

# 最大数
for i in range(len(list1)-1):
    for j in range(len(list1)-i-1):
        if list1[j] > list1[j+1]:
            list1[j], list1[j+1] = list1[j+1], list1[j]

max_value = list1[-1]
print(max_value)